﻿var secs;
var timerID = null;
var timerRunning = false;
var timeout = 3;
var delay = 1000;

var STATimerFlag = 0;

var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var bigsub   = "width=700,height=440,scrollbars,menubar,resizable,status,dependent=yes";
var datSubWinVar = null;
var CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

var hex_chr = "0123456789abcdef"; 

function rhex(num) 
{ 
   str = ""; 
   for(j = 0; j <= 3; j++) 
   str += hex_chr.charAt((num >> (j * 8 + 4)) & 0x0F) + 
   hex_chr.charAt((num >> (j * 8)) & 0x0F); 
   return str; 
} 

function str2blks_MD5(str) 
{ 
   nblk = ((str.length + 8) >> 6) + 1; 
   blks = new Array(nblk * 16); 
   for(i = 0; i < nblk * 16; i++) blks[i] = 0; 
   for(i = 0; i < str.length; i++) 
   blks[i >> 2] |= str.charCodeAt(i) << ((i % 4) * 8); 
   blks[i >> 2] |= 0x80 << ((i % 4) * 8); 
   blks[nblk * 16 - 2] = str.length * 8; 
   return blks; 
}
 
function add(x, y) 
{ 
   var lsw = (x & 0xFFFF) + (y & 0xFFFF); 
   var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 
   return (msw << 16) | (lsw & 0xFFFF); 
} 

function rol(num, cnt) 
{ 
   return (num << cnt) | (num >>> (32 - cnt)); 
} 

function cmn(q, a, b, x, s, t) 
{ 
   return add(rol(add(add(a, q), add(x, t)), s), b); 
} 

function ff(a, b, c, d, x, s, t) 
{ 
   return cmn((b & c) | ((~b) & d), a, b, x, s, t); 
} 

function gg(a, b, c, d, x, s, t) 
{ 
   return cmn((b & d) | (c & (~d)), a, b, x, s, t); 
} 

function hh(a, b, c, d, x, s, t) 
{ 
   return cmn(b ^ c ^ d, a, b, x, s, t); 
} 

function ii(a, b, c, d, x, s, t) 
{ 
    return cmn(c ^ (b | (~d)), a, b, x, s, t); 
} 

function MD5(str) 
{ 
   x = str2blks_MD5(str); 
   var a = 1732584193; 
   var b = -271733879; 
   var c = -1732584194; 
   var d = 271733878; 
   for(i = 0; i < x.length; i += 16) 
   { 
        var olda = a; 
        var oldb = b; 
        var oldc = c; 
        var oldd = d; 
        a = ff(a, b, c, d, x[i+ 0], 7 , -680876936); 
        d = ff(d, a, b, c, x[i+ 1], 12, -389564586); 
        c = ff(c, d, a, b, x[i+ 2], 17, 606105819); 
        b = ff(b, c, d, a, x[i+ 3], 22, -1044525330); 
        a = ff(a, b, c, d, x[i+ 4], 7 , -176418897); 
        d = ff(d, a, b, c, x[i+ 5], 12, 1200080426); 
        c = ff(c, d, a, b, x[i+ 6], 17, -1473231341); 
        b = ff(b, c, d, a, x[i+ 7], 22, -45705983); 
        a = ff(a, b, c, d, x[i+ 8], 7 , 1770035416); 
        d = ff(d, a, b, c, x[i+ 9], 12, -1958414417); 
        c = ff(c, d, a, b, x[i+10], 17, -42063); 
        b = ff(b, c, d, a, x[i+11], 22, -1990404162); 
        a = ff(a, b, c, d, x[i+12], 7 , 1804603682); 
        d = ff(d, a, b, c, x[i+13], 12, -40341101); 
        c = ff(c, d, a, b, x[i+14], 17, -1502002290); 
        b = ff(b, c, d, a, x[i+15], 22, 1236535329); 
        a = gg(a, b, c, d, x[i+ 1], 5 , -165796510); 
        d = gg(d, a, b, c, x[i+ 6], 9 , -1069501632); 
        c = gg(c, d, a, b, x[i+11], 14, 643717713); 
        b = gg(b, c, d, a, x[i+ 0], 20, -373897302); 
        a = gg(a, b, c, d, x[i+ 5], 5 , -701558691); 
        d = gg(d, a, b, c, x[i+10], 9 , 38016083); 
        c = gg(c, d, a, b, x[i+15], 14, -660478335); 
        b = gg(b, c, d, a, x[i+ 4], 20, -405537848); 
        a = gg(a, b, c, d, x[i+ 9], 5 , 568446438); 
        d = gg(d, a, b, c, x[i+14], 9 , -1019803690); 
        c = gg(c, d, a, b, x[i+ 3], 14, -187363961);  
        b = gg(b, c, d, a, x[i+ 8], 20, 1163531501); 
        a = gg(a, b, c, d, x[i+13], 5 , -1444681467); 
        d = gg(d, a, b, c, x[i+ 2], 9 , -51403784); 
        c = gg(c, d, a, b, x[i+ 7], 14, 1735328473); 
        b = gg(b, c, d, a, x[i+12], 20, -1926607734); 
        a = hh(a, b, c, d, x[i+ 5], 4 , -378558); 
        d = hh(d, a, b, c, x[i+ 8], 11, -2022574463); 
        c = hh(c, d, a, b, x[i+11], 16, 1839030562); 
        b = hh(b, c, d, a, x[i+14], 23, -35309556); 
        a = hh(a, b, c, d, x[i+ 1], 4 , -1530992060); 
        d = hh(d, a, b, c, x[i+ 4], 11, 1272893353); 
        c = hh(c, d, a, b, x[i+ 7], 16, -155497632); 
        b = hh(b, c, d, a, x[i+10], 23, -1094730640); 
        a = hh(a, b, c, d, x[i+13], 4 , 681279174); 
        d = hh(d, a, b, c, x[i+ 0], 11, -358537222); 
        c = hh(c, d, a, b, x[i+ 3], 16, -722521979); 
        b = hh(b, c, d, a, x[i+ 6], 23, 76029189); 
        a = hh(a, b, c, d, x[i+ 9], 4 , -640364487); 
        d = hh(d, a, b, c, x[i+12], 11, -421815835); 
        c = hh(c, d, a, b, x[i+15], 16, 530742520); 
        b = hh(b, c, d, a, x[i+ 2], 23, -995338651); 
        a = ii(a, b, c, d, x[i+ 0], 6 , -198630844); 
        d = ii(d, a, b, c, x[i+ 7], 10, 1126891415); 
        c = ii(c, d, a, b, x[i+14], 15, -1416354905); 
        b = ii(b, c, d, a, x[i+ 5], 21, -57434055); 
        a = ii(a, b, c, d, x[i+12], 6 , 1700485571); 
        d = ii(d, a, b, c, x[i+ 3], 10, -1894986606); 
        c = ii(c, d, a, b, x[i+10], 15, -1051523); 
        b = ii(b, c, d, a, x[i+ 1], 21, -2054922799); 
        a = ii(a, b, c, d, x[i+ 8], 6 , 1873313359); 
        d = ii(d, a, b, c, x[i+15], 10, -30611744); 
        c = ii(c, d, a, b, x[i+ 6], 15, -1560198380); 
        b = ii(b, c, d, a, x[i+13], 21, 1309151649); 
        a = ii(a, b, c, d, x[i+ 4], 6 , -145523070); 
        d = ii(d, a, b, c, x[i+11], 10, -1120210379); 
        c = ii(c, d, a, b, x[i+ 2], 15, 718787259); 
        b = ii(b, c, d, a, x[i+ 9], 21, -343485551); 
        a = add(a, olda); 
        b = add(b, oldb); 
        c = add(c, oldc); 
        d = add(d, oldd); 
    } 
     return rhex(a) + rhex(b) + rhex(c) + rhex(d); 
} 


/*for login start*/
function checkspecialchar(obj)
{
	var s = obj.value;
	for(var i = 0; i < s.length; i++) 
	{
	    if(s.charAt(i).match(/[\u0391-\uFFE5]/) || s.charAt(i).match(/[\u00B7]/)
			|| s.charAt(i).match(/[\u0022]/) || s.charAt(i).match(/[\u0026]/)
			|| s.charAt(i).match(/[\u003E]/) || s.charAt(i).match(/[\u003C]/)
			|| s.charAt(i).match(/[\u005C]/))
		{ 
			return false; 
		}
	}
	return true;
}

function base64encode(str) 
{
    var out, i, len;
    var c1, c2, c3;
    len = str.length;
    i = 0;
    out = "";
	
    while(i < len) 
	{
		 c1 = str.charCodeAt(i++) & 0xff;
		 if(i == len)
		 {
		     out += base64EncodeChars.charAt(c1 >> 2);
		     out += base64EncodeChars.charAt((c1 & 0x3) << 4);
		     out += "==";
		     break;
		 }
		 c2 = str.charCodeAt(i++);
		 if(i == len)
		 {
		     out += base64EncodeChars.charAt(c1 >> 2);
		     out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
		     out += base64EncodeChars.charAt((c2 & 0xF) << 2);
		     out += "=";
		     break;
		 }
		 c3 = str.charCodeAt(i++);
		 out += base64EncodeChars.charAt(c1 >> 2);
		 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
		 out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
		 out += base64EncodeChars.charAt(c3 & 0x3F);
    }
    return out;
}

function utf16to8(str) {
    var out, i, len, c;
    out = "";
    len = str.length;
    for(i = 0; i < len; i++) 
	{
		 c = str.charCodeAt(i);
		 if ((c >= 0x0001) && (c <= 0x007F)) 
		 {
		     out += str.charAt(i);
		 } 
		 else if (c > 0x07FF) 
		 {
		     out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
		     out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));
		     out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
		 } 
		 else
		 {
		     out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));
		     out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
		 }
    }
	
    return out;
}

function uuid(len, radix)
{
	var chars = CHARS, uuid = [], i;
    radix = radix || chars.length;
 
    if (len) 
	{
		// Compact form
		for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
    } else 
	{
		// rfc4122, version 4 form
		var r;
 
		// rfc4122 requires these characters
		uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
		uuid[14] = '4';

		// Fill in random data.  At i==19 set the high bits of clock sequence as
		// per rfc4122, sec. 4.1.5
		for (i = 0; i < 36; i++) 
		{
			if (!uuid[i]) 
			{
			  r = 0 | Math.random()*16;
			  uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
			}
		}
	}
	return uuid.join('');
}
/*for login end*/

function style_display_on()
{
	if (window.ActiveXObject)
	{ // IE
		return "block";
	}
	else if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		return "table-row";
	}
}

function getFileSize(target)
{
	var fileSize = 0;
	var isIE;
	//var isIE = navigator.userAgent.indexOf("MSIE")>=1?true:false;
	if (!!window.ActiveXObject || "ActiveXObject" in window)  
	{
		isIE = true;
	}
	else
	{
		isIE = false;
	}
	//console.dir(target.files);
	//console.dir(isIE);
    if (isIE && !target.files) 
	{
        //alert("id:"+target.id);
		//console.log("here");
		target.select();
		var filePath = document.selection.createRange().text;
		//alert("filePath:"+filePath);
		var image = new Image();
		image.src = filePath;
        fileSize = image.fileSize;
		//alert("fileSize:"+fileSize);
    }else 
	{
        fileSize = target.files[0].size;
    }
    return fileSize;
}

function isNumber(oNum)    
{    
  if(!oNum) return false;    
  var strP=/^\d+$/;    
  if(!strP.test(oNum)) return false;       
  return true;    
}
// this function is used to check if the inputted string is blank or not.
function isBlank(s)
{
	var i=0;
	for(i=0;i<s.length;i++)
	{
		c=s.charAt(i);
		if((c!=' ')&&(c!='\n')&&(c!='\t'))return false;
	}
	return true;
}
function isAllAscii(str)
{
    for (var i = 0; i < str.length; i++)
    {
        if ((str.charAt(i) >= '!' && str.charAt(i) <= '~'))
            continue;
        return false;
    }
    
    return true;
}

function isAllNum(str)
{
	for (var i=0; i<str.length; i++) {
		if ((str.charAt(i) >= '0' && str.charAt(i) <= '9') || (str.charAt(i) == '.' ))
			continue;
		return 0;
	}
	return 1;
}
function isAllIntNum(str)
{
    	for (var i=0; i<str.length; i++) {
		if(str.charAt(i) >= '0' && str.charAt(i) <= '9') 
			continue;
		return 0;
	}
	return 1;
}

/*check Mac*/
function checkMac(fobj)
{
	var j=0;
	var macvalue=fobj.value;
	var myRE = /[0-9a-fA-F]{12}/;
	var mactmp="";	
	
	if(macvalue.length!=17)
		return false;
		
	else if(macvalue.length==17){
		if(macvalue.charAt(2)==':')
		{
			for(j=2;j<17;j+=3)
        		{
            			if(macvalue.charAt(j)!=':')
            			{
                			return false;
            			}
        		}
			mactmp = macvalue.replace(/:/g,"");
		}	
		else if(macvalue.charAt(2)=='-')
		{
			for(j=2;j<17;j+=3)
        		{
            			if(macvalue.charAt(j)!='-')
            			{
                			return false;
            			}
        		}
			mactmp = macvalue.replace(/-/g,"");
		}
		else
			return false;			
		
		if(mactmp.length != 12 || myRE.test(mactmp)!=true)	
		{
			return false;
		}		
	}
	else
	{
		return false;
	}
	return true;
}	
function showMac(obj)
{
	 	var mac=obj.toUpperCase();
		if(mac.charAt(2)=="-")
			mac=mac.replace(/-/g,":");
		return mac;	
}
function atoi(str, num)
{
    i = 1;
    if (num != 1)
    {
        while (i != num && str.length != 0)
        {
            if (str.charAt(0) == '.')
            {
                i++;
            }
            str = str.substring(1);
        }
        if (i != num)
            return  - 1;
    }

    for (i = 0; i < str.length; i++)
    {
        if (str.charAt(i) == '.')
        {
            str = str.substring(0, i);
            break;
        }
    }
    if (str.length == 0)
        return  - 1;
    return parseInt(str, 10);
}

function checkStrictInjection(str)
{
	var len = str.length;	
	for (var i=0; i<str.length; i++) {
		if ( str.charAt(i) == ';' || str.charAt(i) == ',' ||
			 str.charAt(i) == '\r' || str.charAt(i) == '\n'){
				return false;
		}else
	        continue;
	}
    return true;
}

function splitAddr (str,addr)
{
	var arr = addr.split('.');
	var elements = $('input[name='+str+']');
	var i = 0,j=elements.length;
	for(;i<j;i++){
		elements[i].value = arr[i];
	}
}

function checkIpAddr(field, ismask)
{
	if (field.value == "") {
		alert("Error. IP address is empty.");
		field.value = field.defaultValue;
		field.focus();
		return false;
	}

	if (isAllNum(field.value) == 0) {
		alert('It should be a [0-9] number.');
		field.value = field.defaultValue;
		field.focus();
		return false;
	}

	if (ismask) {
		if ((!checkRange(field.value, 1, 0, 255)) ||
				(!checkRange(field.value, 2, 0, 255)) ||
				(!checkRange(field.value, 3, 0, 255)) ||
				(!checkRange(field.value, 4, 0, 255)))
		{
			alert('IP adress format error.');
			field.value = field.defaultValue;
			field.focus();
			return false;
		}
	}
	else {
		if ((!checkRange(field.value, 1, 0, 255)) ||
				(!checkRange(field.value, 2, 0, 255)) ||
				(!checkRange(field.value, 3, 0, 255)) ||
				(!checkRange(field.value, 4, 1, 254)))
		{
			alert('IP adress format error.');
			field.value = field.defaultValue;
			field.focus();
			return false;
		}
	}
	return true;
}

/*check IP start */
function checkIp(fobj)
{ 		
	var tmp = fobj.value;
	var ip= /^([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
	if(ip.exec(tmp)==null)
		return false;
  var ipaddr = tmp.split(".");
	if(ipaddr.length != 4 ) 
		return false; 	
	for(i = 0; i < 4; i++) {
		if(ipaddr[i] =="")
		return false;   
	}	    
    if(parseInt(ipaddr[0]) == 127 || ( parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240))
        return false;    
    if(parseInt(ipaddr[0]) >0 && parseInt(ipaddr[0]) <255 && parseInt(ipaddr[1])>=0 && parseInt(ipaddr[1])<=255 && parseInt(ipaddr[2])>=0 && parseInt(ipaddr[2])<=255 && parseInt(ipaddr[3])>0 && parseInt(ipaddr[3])<255) 
        return true;  
    else
    	return false; 
/*	var ip= /^([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
	if(ip.exec(fobj)==null)
		return false;
    var ipaddr = fobj.split(".");
	if(ipaddr.length != 4 ) 
		return false; 	
	for(i = 0; i < 4; i++) {
		if(ipaddr[i] =="")
		return false;   
	}	    
    if(parseInt(ipaddr[0]) == 127 || ( parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240))
        return false;    
    if(parseInt(ipaddr[0]) >0 && parseInt(ipaddr[0]) <255 && parseInt(ipaddr[1])>=0 && parseInt(ipaddr[1])<=255 && parseInt(ipaddr[2])>=0 && parseInt(ipaddr[2])<=255 && parseInt(ipaddr[3])>0 && parseInt(ipaddr[3])<255) 
        return true;  
    else
    	return false; 	*/
}
/*check IP end */

/*check IP start */
function checkIp12(fobj)
{ 		
	var tmp = fobj.value;
	var ip= /^([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([1-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
	if(ip.exec(tmp)==null)
		return false;
  var ipaddr = tmp.split(".");
	if(ipaddr.length != 4 ) 
		return false; 	
	for(i = 0; i < 4; i++) {
		if(ipaddr[i] =="")
		return false;   
	}	    
//    if(parseInt(ipaddr[0]) == 127 || ( parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240))
	if( parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240)
        return false;    
    if(parseInt(ipaddr[0]) >0 && parseInt(ipaddr[0]) <255 && parseInt(ipaddr[1])>=0 && parseInt(ipaddr[1])<=255 && parseInt(ipaddr[2])>=0 && parseInt(ipaddr[2])<=255 && parseInt(ipaddr[3])>0 && parseInt(ipaddr[3])<255) 
        return true;  
    else
    	return false; 	
}
/*check IP end */

/*check NET start */
function checkNetIp(fobj) 
{ 		
	var tmp = fobj.value;
    var ipaddr = tmp.split(".");
	if(ipaddr.length != 4 ) 
		return false; 	
	for(i = 0; i < 4; i++) {
		if(ipaddr[i] =="")
		return false;   
	}	    
    if(parseInt(ipaddr[0]) == 127 || ( parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240))
        return false;    
    if(parseInt(ipaddr[0]) >0 && parseInt(ipaddr[0]) <255 && parseInt(ipaddr[1])>=0 && parseInt(ipaddr[1])<=255 && parseInt(ipaddr[2])>=0 && parseInt(ipaddr[2])<=255 && parseInt(ipaddr[3])>=0 && parseInt(ipaddr[3])<255) 
        return true;  
    else
    	return false; 	
}
/*check NET end */
/*check WEB IP start */
function checkWebIp(fobj) 
{ 		
	var tmp = fobj.value;
	var ip= /^([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){2}([0-9]|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$/;
	if(ip.exec(tmp)==null)
		return 0;
    var ipaddr = tmp.split(".");
	if(ipaddr.length != 4 ) 
		return 0; 	
	for(i = 0; i < 4; i++) {
		if(ipaddr[i] =="")
		return 0;   
	}	    
    if(parseInt(ipaddr[0]) == 127 || (parseInt(ipaddr[0])>223 && parseInt(ipaddr[0])<240))
        return 0;
	if(parseInt(ipaddr[0]) ==0 && parseInt(ipaddr[1]) ==0 && parseInt(ipaddr[2]) ==0 && parseInt(ipaddr[3]) ==0){			
		return 2;
	}
	if(parseInt(ipaddr[0]) ==255 && parseInt(ipaddr[1]) ==255 && parseInt(ipaddr[2]) ==255 && parseInt(ipaddr[3]) ==255){			
		return 3;
	}	
    if(parseInt(ipaddr[0]) >0 && parseInt(ipaddr[0]) <255 && parseInt(ipaddr[1])>=0 && parseInt(ipaddr[1])<=255 && parseInt(ipaddr[2])>=0 && parseInt(ipaddr[2])<=255 && parseInt(ipaddr[3])>0 && parseInt(ipaddr[3])<255)  
        return 1;  
    else
    	return 0; 	
}
/*check WEB IP end */

/*check Mask start */
function changeIP(ip) 
{ 
	return (ip+256).toString(2).substring(1); 
} 

function checkMask(fobj) 
{ 
	var MaskStr = fobj.value;
	var IPPattern = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
	if(!IPPattern.test(MaskStr))return false; 
	
	var IPArray = MaskStr.split("."); 
	var ip1 = parseInt(IPArray[0]); 
	var ip2 = parseInt(IPArray[1]); 
	var ip3 = parseInt(IPArray[2]); 
	var ip4 = parseInt(IPArray[3]); 
	if ( ip1<=0 || ip1>255 
	   || ip2<0 || ip2>255 
	   || ip3<0 || ip3>255 
	   || ip4<0 || ip4>255 ) 
	{ 
	   return false; 
	} 	
	var ip_binary = changeIP(ip1) + changeIP(ip2) + changeIP(ip3) + changeIP(ip4); 	
	if(-1 != ip_binary.indexOf("01"))  return false; 
	return true; 
} 
/*check Mask end */

function checkRange(str, num, min, max)
{
    d = atoi(str,num);
    if(d > max || d < min)
        return false;
    return true;
}
function disableTextField (field)
{
  if(document.all || document.getElementById)
    field.disabled = true;
  else {
    field.oldOnFocus = field.onfocus;
    field.onfocus = skip;
  }
}
function enableTextField (field)
{
  if(document.all || document.getElementById)
    field.disabled = false;
  else {
    field.onfocus = field.oldOnFocus;
  }
}
function checkAllNum(str)
{
    for (var i=0; i<str.length; i++){
        if(str.charAt(i) >= '0' && str.charAt(i) <= '9')
        {
            continue;
        }
        return false;
    }
    return true;
}
function checkInputLang(str){
	for(j=0;j<str.length;j++){
		var c = str.substr(j,1);
		var ts = escape(c);
		if(ts.substring(0,2) == "%u"){
			str.value = "";
			return false;
		}
	}
	return true;
}
function checkAllNumEn(str)
{
    for (var i=0; i<str.length; i++){
        if(str.charAt(i) >= '0' && str.charAt(i) <= '9')
        {
            continue;
        }
        return false;
    }
    return true;
}
function checkHex(str)
{
	var len = str.length;

	for (var i=0; i<str.length; i++) {
		if ((str.charAt(i) >= '0' && str.charAt(i) <= '9') ||
			(str.charAt(i) >= 'a' && str.charAt(i) <= 'f') ||
			(str.charAt(i) >= 'A' && str.charAt(i) <= 'F') ){
				continue;
		}else
	        return false;
	}
    return true;
}

function checkInjection(str)
{
	var len = str.length;
	for (var i=0; i<str.length; i++) {
		if ( str.charAt(i) == '\r' || str.charAt(i) == '\n'){
				return false;
		}else
	        continue;
	}
    return true;
}
function checkUserName(field)
{
    var user_name = field.value;
    var patrn=/^\w+$/;	
	            
    if (!patrn.test(user_name))
    {
        return false;
    }
    return true;
}

function checkPassWordForUserName(field)
{
	var user_name = field.value;
	var i;
	for( i = 0; i < user_name.length; i++ )
	{
		if(('a' <= user_name.charAt(i) && 'z' >= user_name.charAt(i))
			||('A' <= user_name.charAt(i) && 'Z' >= user_name.charAt(i))
			||('0' <= user_name.charAt(i) && '9' >= user_name.charAt(i))
			||(user_name.charAt(i)=='_')
			||(user_name.charAt(i)=='@')
			||(user_name.charAt(i)=='.')
			||(user_name.charAt(i)=='-'))
			continue;
		else
		{
			return false;
		}
	}		
	return true;
}

/* get network or broadcast address by ip and mask  start*/
function netOrBroadAddr(IP, MASK, SoE)
{
	var IP_AMOUNT_MAX = 256;
	var ip = IP.split(".");
	var mask = MASK.split(".");
	var i;

	for(i=0;i<ip.length;i++)
	{
		/* SoE=0:show this Network IP ; SoE=1:show this Network Broadcast IP */
		if(SoE==1)
		{
			mask[i] = ~mask[i] + IP_AMOUNT_MAX;
			ip[i] = ip[i] | mask[i];
		}
		else
			ip[i] = ip[i] & mask[i];
	}
	return ip.join(".");
}
/* get network or broadcast address by ip and mask  end*/

function checkdomain(dm)
{
	var postfix = /^([\w-]+\.)+((aero)|(asia)|(biz)|(cat)|(com)|(coop)|(edu)|(gov)|(info)|(jobs)|(mil)|(mobi)|(museum)|(name)|(net)|(org)|(pro)|(tel)|(travel)|(xxx)|(ac)|(ad)|(ae)|(af)|(ag)|(ai)|(al)|(am)|(an)|(ao)|(aq)|(ar)|(as)|(at)|(au)|(aw)|(ax)|(az)|(ba)|(bb)|(bd)|(be)|(bf)|(bg)|(bh)|(bi)|(bj)|(bm)|(bn)|(bo)|(br)|(bs)|(bt)|(bv)|(bw)|(by)|(bz)|(ca)|(cc)|(cd)|(cf)|(cg)|(ch)|(ci)|(ck)|(cl)|(cm)|(cn)|(co)|(cr)|(cu)|(cv)|(cx)|(cy)|(cz)|(de)|(dj)|(dk)|(dm)|(dz)|(ec)|(ee)|(eg)|(er)|(es)|(et)|(eu)|(fi)|(fj)|(fk)|(fm)|(fo)|(fr)|(ga)|(gb)|(gd)|(ge)|(gf)|(gg)|(gh)|(gi)|(gl)|(gm)|(gn)|(gp)|(gq)|(gr)|(gs)|(gt)|(gu)|(gw)|(gy)|(hk)|(hm)|(hn)|(hr)|(ht)|(hu)|(COM)|(CN))$/;
	var postfix1 =/^([\w-]+\.)+((id)|(ie)|(il)|(im)|(io)|(iq)|(ir)|(is)|(it)(je)|(jm)|(jo)|(jp)|(ke)|(kg)|(kh)|(ki)|(km)|(kn)|(kp)|(kr)|(kw)|(ky)|(kz)|(la)|(lb)|(lc)|(li)|(lk)|(lr)|(ls)|(lt)|(lu)|(lv)|(ly)|(ma)|(mc)|(md)|(me)|(mg)|(mh)|(mk)|(ml)|(mm)|(mn)|(mo)|(mp)|(mq)|(mr)|(ms)|(mt)|(mu)|(mv)|(mw)|(mx)|(my)|(mz)|(na)|(nc)|(ne)|(nf)|(ng)|(ni)|(nl)|(no)|(np)|(nr)|(nu)|(nz)|(om)|(pa)|(pe)|(pf)|(pg)|(ph)|(pk)|(pl)|(pm)|(pn)|(pr)|(ps)|(pt)|(pw)|(py)|(qa)|(re)|(ro)|(rs)|(ru)|(rw)|(sa)|(sb)|(sc)|(sd)|(se)|(sg)|(sh)|(si)|(sj)|(sk)|(sl)|(sm)|(sn)|(so)|(sr)|(st)|(su)|(sv)|(sy)|(sz)|(tc)|(td)|(tf)|(tg)|(th)|(tj)|(tk)|(tl))$/;	
	var postfix2 =/^([\w-]+\.)+((tm)|(tn)|(to)|(tp)|(tr)|(tt)|(tv)|(tw)|(tz)|(ua)|(ug)|(uk)|(us)|(uy)|(uz)|(va)|(vc)|(ve)|(vg)|(vi)|(vn)|(vu)|(wf)|(ws)|(ye)|(yt)|(za)|(zm)|(zw))$/;
	if(!postfix.test(dm) && !postfix1.test(dm) && !postfix2.test(dm))
	    {
	        return false;
	    }

	return true;
} 
function isAllEngAndNum(str)
{
	for (var i=0; i<str.length; i++){
		if((str.charAt(i) >= 'a' && str.charAt(i) <= 'z') || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') ||
			(str.charAt(i) >= '0' && str.charAt(i) <= '9') )
			continue;
		return false;
	}
	return true;
}

function isAllEngAndChAndNum(str){
    var patt1 = /^[\u4e00-\u9fa5a-zA-Z0-9]{1,}$/;
    var patt2 = /[\u4e00-\u9fa5]{0,7}/;
    // console.log(str);
    // console.log(patt1.test(str));
    // console.log(patt2.test(str));
    if(patt1.test(str) && patt2.test(str))
    {
        return true;
    }
    return false;
}

function isRealLength(str)
{
    var temp = str.replace(/[^\x00-\xff]/g, 'xx');
    return temp.length;
}

function isValidChar(s)
{
		var patt1 = /[\u2e80-\ufe4f]+/;
		var patt2 = /[\\;:：]+/;
		if(patt1.test(s) == true || patt2.test(s) == true)
			return false; 
		return true;

}
/* valid port 
* args :port 
* Return : if success then return true else return false. */
function valid_port(port)
{    
	var	port = port.replace(/(\s*)$/,"");

	var temp_port = port.split(" ");    
	if (isNaN(port) || port == "" || temp_port.length > 1    		
		|| (parseInt(port) < 1 || parseInt(port) > 65535) 
		|| (parseInt(port) > 1 && parseInt(port) < 1024) 
		|| port.indexOf(".")>=0 || port.indexOf("-")>=0) 
		{        
		return false;    
		}    
	return true;
}
function valid_port0(port)
{    
	var	port = port.replace(/(\s*)$/,"");

	var temp_port = port.split(" ");    
	if (isNaN(port) || port == "" || temp_port.length > 1    		
		|| (parseInt(port) < 1 || parseInt(port) > 65535) 
		|| port.indexOf(".")>=0 || port.indexOf("-")>=0) 
		{        
		return false;    
		}    
	return true;
}
function isPortRange( form_port, to_port )
{
    if( parseInt( form_port ) > parseInt( to_port ) )
        return false;

    return true;
}
function getDigit(str, num)
{
  i=1;
  if ( num != 1 ) {
  	while (i!=num && str.length!=0) {
		if ( str.charAt(0) == '.' ) {
			i++;
		}
		str = str.substring(1);
  	}
  	if ( i!=num )
  		return -1;
  }
  for (i=0; i<str.length; i++) {
  	if ( str.charAt(i) == '.' ) {
		str = str.substring(0, i);
		break;
	}
  }
  if ( str.length == 0)
  	return -1;
  var d = parseInt(str, 10);
  return d;
}

function validateKey(str)
{
	for (var i=0; i<str.length; i++) {
		if ( (str.charAt(i) >= '0' && str.charAt(i) <= '9') ||
				(str.charAt(i) == '.' ) )
				continue;
	return 0;
	}
	var item_str = str.split('.');
	for(i=0; i<item_str.length; i++)
	{
		if(item_str[i].charAt(0) == '0' && item_str[i].charAt(1) !='')
			return 2;
	}
  return 1;
}

function checkDigitRange(str, num, min, max)
{
  var d = getDigit(str,num);
  if ( d > max || d < min )
      	return false;
  return true;
}

function checkDigitRange1(str, num, min, max)
{
  var d = getDigit(str,num);
  if ( d > max || d < min )
      	return true;
  return false;
}

function isValidPortRange(port) {
   var fromport = 0;
   var toport = 100;

   portrange = port.split(':');
   if ( portrange.length < 1 || portrange.length > 2 ) {
       return false;
   }
   if ( isNaN(portrange[0]) )
       return false;
   fromport = parseInt(portrange[0]);

   if ( portrange.length > 1 ) {
       if ( isNaN(portrange[1]) )
          return false;
       toport = parseInt(portrange[1]);
       if ( toport <= fromport )
           return false;
   }

   if ( fromport < 1 || fromport > 65535 || toport < 1 || toport > 65535 )
       return false;

   return true;
}

function isValidBWRange(bwMin, bwMax)
{
    if ((parseInt(bwMin) > 102400) || (parseInt(bwMax) > 102400) || (parseInt
        (bwMin) > parseInt(bwMax)))
    return false 

        return true;
}
function isValidPort( port )
{
    if( !checkAllNum( port ) )
        return false;

    var i_port = parseInt( port );
    if( i_port < 1 || i_port > 65535 )
       return false;
    
    return true;
}
function isEnglish(name)
{
	/* valid character:*/
	var re = /^\w+$/;
	if ( !re.test(name) )
		return false;
	return true;
}
function isValidPortRangeEx( form_port, to_port )
{
    if( !isValidPort( form_port ) || !isValidPort( to_port ) )
        return false;

    if( parseInt( form_port ) > parseInt( to_port ) )
        return false;

    return true;
}
function isIncludeStr(strSrc, strCheck)
{
	if ( strSrc.indexOf(strCheck) == -1 )
		return false;
	else
		return true;
}

function InitializeWpsTimer()
{
    // Set the length of the timer, in seconds
//	timeout = default
    secs = timeout;
    StopTheWpsClock();
    StartTheWpsTimer();
}
//zengqingchu

function StopTheWpsClock()
{
    if(timerRunning)
        clearTimeout(timerID);
    timerRunning = false;
}

function StartTheWpsTimer()
{
    if (secs==0)
    {
		StopTheWpsClock();

		if(STATimerFlag == 0)
			updateWPS();
		else
			updateWPSStaStatus();

		secs = timeout;
		StartTheWpsTimer();
    }else{
		self.status = secs;
		secs = secs - 1;
		timerRunning = true;
		timerID = self.setTimeout("StartTheWpsTimer()", delay);
    }
}

function displayOn()
{
	if (window.ActiveXObject)
	{ // IE
		return "block";
	}
	else if (window.XMLHttpRequest)
	{ // Mozilla, Safari,...
		return "";
	}
}
function create_backmask()
{
	var bgObj = window.top.document.getElementById('bgDiv');
	bgObj.style.display = "";	
}
function remove_backmask()
{
	window.top.document.getElementById('bgDiv').style.display="none";	
	window.top.document.getElementsByTagName('link')[0].href = "css/style.css";	
//	window.top.document.getElementById("iframepage").height = 1050;
	window.top.document.getElementById("iframepage").height = 1250;
}
function setElementHide(form_id, flag)
{
    var e = document.getElementById(form_id);
    if (e)
    {
        if (true == flag)
        {
            e.style.visibility = "hidden";
            e.style.display = "none";
        }
        else
        {
            e.style.visibility = "visible";
            e.style.display = displayOn();
        }
    }
}

function update()
{
    create_backmask();
    document.getElementById("loading").style.display = "block";
}

var http_request = false;
function _makePostRequest(url, content, handler)
{
    var http_request = false;
    if (window.XMLHttpRequest)
    {
        // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType)
        {
            http_request.overrideMimeType('text/xml');
        }
    }
    else if (window.ActiveXObject)
    {
        // IE
        try
        {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                http_request = false;
            }
        }
    }
    if (!http_request)
    {

		return false;
	}
	http_request.open('POST', url, true);
	http_request.send(content);
	http_request.onreadystatechange = handler;

	return http_request;
}

//var lang_change_request = false;

function onLangueChangedHandler()
{
	window.location.reload(true);
	lang_change_request = false;
}

function setUiLanguage(language, cur_language)
{
	var lang_tmp = "preferred_lang=" + language;
    if ((language != "") && (language != cur_language))
        lang_change_request = _makePostRequest("lang.cgi", lang_tmp,
            onLangueChangedHandler);
}

function init_LanguageSel(obj_id, cur_language)
{
    var e = document.getElementById(obj_id);
    if (e)
    {
        e.value = cur_language;
    }
}

var TAB_CODE=9;
var DEL_CODE=46;
var BS_CODE=8;
var SP_CODE=32;
var DOT_CODE=190;
var DOT2_CODE=110;
var ARROW_CODE=39;

function IPKeyUp(e,prefix,idx)
{
	var obj=document.getElementsByName(prefix+idx);
	var len;
	var nextidx = idx + 1;
	var keynum;
 
    if(window.event)
		keynum = event.keyCode;
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which;
 
 	
	if(keynum == TAB_CODE || keynum == BS_CODE) return;
 
	len = obj[0].value.length;
	
	if(keynum == DOT_CODE || keynum == DOT2_CODE || keynum == ARROW_CODE)
	{
		if(len == 0) return;
		obj=document.getElementsByName(prefix+nextidx);
		if(obj[0]) obj[0].focus();
		return;
	}
	obj[0].value = obj[0].value.toUpperCase();
}

function IPKeyDown(e,prefix,idx)
{
	var obj=document.getElementsByName(prefix+idx);
	var previdx = idx - 1;
 
       	if(window.event)
		keynum = event.keyCode;
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which;
 
 //alert(keynum);
 
	if((keynum == TAB_CODE)
	    || (keynum == DEL_CODE) 
	    || (keynum == BS_CODE) )
	{
		if(obj[0].value.length == 0 && keynum == BS_CODE)
		{
			obj=document.getElementsByName(prefix+previdx);
			if(obj[0]) obj[0].focus();
		}
		return 1;
	}
 
 
	return CheckNum(keynum);
}

function CheckNum(keynum)
{
	if( ((keynum >= 96) && keynum <= 105) 
	  ||((keynum >= 48) && keynum <= 57)
	  )
		return true;
	return false;
}
function checkNumRange( str, begin, end )
{
    if( str.length == 0 )
        return false;

    if( isAllIntNum( str ) == false )
        return false;

    var i_val = parseInt( str );
    if( i_val < begin || i_val > end  )
        return false;

    return true;
}
function checkServerForm(str)
{
	for(var i=0; i<str.length; i++)
	{
		if((str.charAt(i) >= '0' && str.charAt(i) <= '9') || (str.charAt(i) == '.') || (str.charAt(i) == '-') ||
			(str.charAt(i) == '_') || (str.charAt(i) >= 'a' && str.charAt(i) <= 'z') || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z'))
		{
			if( i==0 || i==(str.length-1) )
			{
				if( (str.charAt(i) == '.') || (str.charAt(i) == '-') || (str.charAt(i) == '_'))
					return false;
			}
			else
			{
				if((str.charAt(i) == '.' && str.charAt(i+1) == '.'))
				{
					return false;
				}
			}
			continue;
		}
		return false;
	}
	return true;
}
function cleardata(namestr)
{
	var cf = document.forms[0];
	var j;
	var dataname = namestr;
	for(j=0;j < cf.elements.length;j++){
		if(dataname == cf.elements[j].name){
			cf.elements[j].value = "";
			cf.elements[j].focus();
		}
	}	
}

function CheckInjection(str)
{
	var len = str.length;
	for (var i = 0; i < str.length; i++) {
		if (str.charAt(i) == ';' || str.charAt(i) == ',' ||
				str.charAt(i) == '\r' || str.charAt(i) == '\n') {
			return false;
		}
		else
			continue;
	}
	return true;
}

function CheckHex(str)
{
	var len = str.length;

	for (var i = 0; i < str.length; i++) {
		if ((str.charAt(i) >= '0' && str.charAt(i) <= '9') ||
				(str.charAt(i) >= 'a' && str.charAt(i) <= 'f') ||
				(str.charAt(i) >= 'A' && str.charAt(i) <= 'F')) {
			continue;
		}
		else
			return false;
	}
	return true;
}

function HWKeyDown(e,prefix,idx)
{
	var obj=document.getElementsByName(prefix+idx);
	var previdx = idx - 1;

 
       	if(window.event)
		keynum = event.keyCode;
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which;
 
	if((keynum == TAB_CODE)
	    || (keynum == DEL_CODE) 
	    || (keynum == BS_CODE) )
	{
		if(obj[0].value.length == 0 && keynum == BS_CODE)
		{
			obj=document.getElementsByName(prefix+previdx);
			if(obj[0]) obj[0].focus();
		}
		return 1;
	}
 
 
	return CheckHex(keynum);
}

function throwBlank(_content)
{
	_content.value = _content.value.replace(/\s*/g,'');
	return _content.value;
}

function show_help(height){
	var link0 = document.getElementsByTagName('link');
	var link1= window.top.document.getElementsByTagName('link');
	var ifm= window.top.document.getElementById("iframepage"); 
	
	if(link0[0].href.indexOf('help')!=-1)
		{
			link0[0].href="css/style.css";
		}
	else
		{
			link0[0].href="css/stylehelp.css";
			if(height)
				ifm.height = height;
		}
	if(link1[0].href.indexOf('help')!=-1)
		link1[0].href="css/style.css";
	else
		link1[0].href="css/stylehelp.css";
}

function styleDisplayOn()
{
    if(window.ActiveXObject) 
	{ // IE
        return "block";
    } else if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
        return "";
	}
}

function onLoadDefault()
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
		} else 
		{
			//alert('There was a problem with the request.');
		}
	}
}

function makeRequest(url, content) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        //alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    http_request.onreadystatechange = onLoadDefault;
    http_request.open('POST', url, true);
    http_request.send(content);
}

function getRadioCheckedValue(radio_object)   // value of selected item, "" if none
{
	var index = 0;
	if (!radio_object)
		return "";
	var size = radio_object.length;
	if(isNaN(size)) 
	{
		if (radio_object.checked == true)
			return radio_object.value;
		else 
			return ""; 
	}
	for (var i = 0; i < size; i++)
	{
		if(!(radio_object[i])) 
			continue;
		if (radio_object[i].checked == true)
			return(radio_object[i].value);
	}
	if (radio_object.checked == true)
		return radio_object.value;
	else 
		return ""; 
}

function setDisabled(OnOffFlag,formFields)
{
	for (var i = 1; i < setDisabled.arguments.length; i++)
		setDisabled.arguments[i].disabled = OnOffFlag;
}

function closeWin(win_var)
{
	if ( ((win_var != null) && (win_var.close)) || ((win_var != null) && (win_var.closed==false)) )
		win_var.close();
}

function openDataSubWin(filename,win_type)
{
	closeWin(datSubWinVar);
	datSubWinVar = window.open(filename,'datasub_win',win_type);
	if (datSubWinVar.focus)
		setTimeout('datSubWinVar.focus()',200);
}

/* check range whether repeat  start*/
function rangeRpt(start1,end1,start2,end2)
{
    var start1=parseInt(start1,10);
    var end1=parseInt(end1,10);
    var start2=parseInt(start2,10);
    var end2=parseInt(end2,10);			
	if(start1<start2 && end1<end2 && start2<=end1){
		return false;
	}
	if(start1>start2 && end1>end2 && start1<=end2){
		return false;
	}
	if(start1<=start2 && end2<=end1){
		return false;
	}
	if(start2<=start1 && end1<=end2){
		return false;
	}
	return true;
}


function isTime(str)
{
    var a = str.match(/^(\d{1,2})(:)?(\d{1,2})\2(\d{1,2})$/);
    if (a == null) 
    {//alert('输入的参数不是时间格式'); 
        return false;
    }
    if (a[1]>24 || a[3]>60 || a[4]>60)
    {
        //alert("时间格式不对");
        return false
    }
return true;
}


function downloadExcel(tableId,data)
{
    var url = "dwDownExcel.php"
	 $.ajax({
        url: url,
        type: "POST",
        timeout: 180000,
        data: $.extend(data,{"table":tableId}),
        dataType: "text",
//      async: true,
        error: function()
        {
            $('#massage_text').text('网络错误。'); 
            return false;
        },
        complete: function()
        {              
            if (status === 'timeout')
            {
                $('#massage_text').text('超时。');
                this.abort();
            }
        },
        success: function(deReturn)
        {

            
        }
    });      
}

function downloadExcel(tableId,formId)
{
	document.getElementById(formId).submit();
	return true;
}

/*tableId:填充数据的table的id
  url： 请求数据的url
  data:请求的数据参数
  pagebn:表格的第几页的控件id
  pageth：请求第几页的数据
  displayCols:表格需要展示的列数
  arrFn：每列数据显示时，需要做的变换
*/
function ajaxLoadDataGrid(tableId, url, data, pagebn, pageth, displayCols, arrFn)
{
	//清空表格
	var tableObj = document.getElementById(tableId);
    var rowslen = tableObj.rows.length;   
    for(var j=rowslen-1;j>=1;j--)
    {
        tableObj.deleteRow(j);
    }
    data = $.extend(data, {"page":pageth});
    //请求数据   
    $.ajax({
        url: url,
        type: "POST",
        timeout: 180000,
        data: data,
        dataType: "text",
//      async: true,
        error: function()
        {
            $('#massage_text').text('网络错误。'); 
            return false;
        },
        complete: function()
        {              
            if (status === 'timeout')
            {
                $('#massage_text').text('超时。');
                this.abort();
            }
        },
        success: function(deReturn)
        {

            var controlertab = jQuery.parseJSON(deReturn);
            var nrows=controlertab.nrows;
            var ncols=controlertab.ncols;
            tableObj.pageMaxium=controlertab.pageMaxium;
//      alert("pagemax:"+pagemax);
            var controlerpagenum=controlertab.controlerpagenum;
            //pageMaxium=parseInt(controlerpagenum);
//      
            for(var l=1;l<=nrows;l++)
            {           
                inrow=tableObj.insertRow(l);          
                inrow.setAttribute("id","s0" + l);
                inrow.setAttribute("align","center");
                for(var m=0;m<displayCols;m++)
                {

                    var incell = inrow.insertCell(m);
                    var fn;
                    if(arrFn[m])
                    {
                    	fn = arrFn[m];
                    	incell.innerHTML = '<td><class="head2" id="s0'+l+'_'+m+'">'+fn(controlertab,l,ncols)+'</td>';
                    }
                    else
                    {
                    	incell.innerHTML = '<td><class="head2" id="s0'+l+'_'+m+'">'+controlertab['s0'+l+'_'+m]+'</td>';
                    }
                                         
                }
                
            }
            var bn=document.getElementById(pagebn);
    //bn.value="第"+pagei+"页"; 
            tableObj.pageIndex = controlertab.controlerpagenum;
            if(isNaN(tableObj.pageIndex))    
            {
                tableObj.pageIndex = 0;
            }
            bn.value=tableObj.pageIndex;     
        }
    });      
}

/****format: 2015-5-9 12:25:32 ********/
/****beginT > endT,true **************/
function compareTime(beginT, endT)
{
	beginT = beginT.replace(/-/g,"/");
	endT = endT.replace(/-/g,"/");
	var beginDate = new Date(beginT);
	var endDate = new Date(endT);
	if(Date.parse(beginDate) >= Date.parse(endDate))
	{
		return true;
	}
	else
	{
		return false;
	}
}